﻿/*
 * Created by SharpDevelop.
 * User: StrunevskyDV
 * Date: 23.01.2010
 * Time: 9:41
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using EmailJabber.Logic.Commands;
using EmailJabber.Logic.Commands.FileViewCommands;
using EmailJabber.EmailJabber.Core.Commands.Common;
using EmailJabber.Logic.Logic.BusinessLogic;

namespace EmailJabber
{
	/// <summary>
	/// Description of MainPoint.
	/// </summary>
	public class MainPoint
	{
       
	    [STAThread]
	    public static void Main()
	    {
	        Console.WriteLine("Start listening port 10025...");

	        FillJabberCommands();

            BL.Instance.CurrentStateLog += InstanceCurrentStateLog;

            
	        while (true)
	        {
	            string line = Console.ReadLine();
	            if(!string.IsNullOrEmpty(line))
	                if(line.Equals("exit"))
	                {
	                    break;
	                }
	        }
	    }

        static void InstanceCurrentStateLog(object sender, EventArgs e)
        {
            Console.WriteLine(e);
        }

	    private static void FillJabberCommands()
	    {
            BL.Instance.BotCommands.Add(new List<string> { "log all" }, CommandManager.Instance.Register(new LogAllCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "help" }, CommandManager.Instance.Register(new HelpCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "log last" },CommandManager.Instance.Register(new GetLastCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "add#" },CommandManager.Instance.Register(new AddToBaseCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "search#", "search " },CommandManager.Instance.Register(new LogSearchCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "dir" },CommandManager.Instance.Register(new DirCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "cd " },CommandManager.Instance.Register(new ChangeDirCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "view " },CommandManager.Instance.Register(new ViewFileCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "autoup" },CommandManager.Instance.Register(new SwitchAutoUpdatesCommand()));
            BL.Instance.BotCommands.Add(new List<string> { "activate "},CommandManager.Instance.Register(new ActivateCommandsFromAssembly()));
	    }

	}
}
